import request from '@/utils/request'

// 创建返工工单
export function createReworkOrder(data) {
  return request({
    url: '/production/rework-order/create',
    method: 'post',
    data: data
  })
}

// 更新返工工单
export function updateReworkOrder(data) {
  return request({
    url: '/production/rework-order/update',
    method: 'put',
    data: data
  })
}

// 删除返工工单
export function deleteReworkOrder(id) {
  return request({
    url: '/production/rework-order/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除返工工单 */
export function deleteReworkOrderList(ids) {
  return request({
    url: `/production/rework-order/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得返工工单
export function getReworkOrder(id) {
  return request({
    url: '/production/rework-order/get?id=' + id,
    method: 'get'
  })
}

// 获得返工工单分页
export function getReworkOrderPage(params) {
  return request({
    url: '/production/rework-order/page',
    method: 'get',
    params
  })
}

// 导出返工工单 Excel
export function exportReworkOrderExcel(params) {
  return request({
    url: '/production/rework-order/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获得返工工单分页
export function getByBatchNo(params) {
  return request({
    url: '/production/material-produce-transfer/getByBatchNo?batchNo=' + params,
    method: 'get',
  })
}
